#coding:utf-8
'''
create on 2017-04-20
@author:sandy
'''
import logging
from pycommon import Const
from pycommon import Pack as packet

def cmdKeepAlive(center,pkt):
    logging.debug(u"center--->gate keepAlive")
    pass

def cmdLoginCenterSuc(center,pkt):
    code = packet.unpack("H",pkt)
    logging.debug(u"bill -> center code = %d",code)
    center.sendPacket(packet.pack("HH",Const.CMD_BILL2CT_PAY_SUCESS,1000))
    center.sendPacket(packet.pack("HH",Const.CMD_BILL2CT_PAY_FAILED,2000))
    

__cmdTable = {
        Const.CMD_KEEP_ALIVE    : cmdKeepAlive,
        Const.CMD_CT2BILL_LOGIN : cmdLoginCenterSuc
    
    }

def parse(center,cmd,pkt):
    if cmd == Const.CMD_KEEP_ALIVE:
        return
    func = __cmdTable.get(cmd)
    if not func:
        logging.error(u"cmd = %d not found",cmd);
    func(center,pkt)

if __name__ == "__main__":
    pass